/*
 * bsp_adc.c
 *
 *  Created on: 2025年4月7日
 *      Author: 22332
 */



#include "cola_init.h"
#include "cola_device.h"
#include "drv_adc.h"

static cola_device_t g_dev_adc;

static int bsp_adc_open(cola_device_t *dev, int oflag){
	(void)dev;
	(void)oflag;
	bsp_drv_adc_init();
    return 0;
}

static int bsp_adc_close(cola_device_t *dev){
	(void)dev;
    return 0;
}


static int bsp_adc_read(cola_device_t *dev, int pos, void *buffer, int size)
{
	(void)dev;
	(void)buffer;
	(void)size;
    return bsp_drv_adc_read(pos);
}

static struct cola_device_ops master_adc_Ops ={
    .open   = bsp_adc_open,
    .close  = bsp_adc_close,
    .read   = bsp_adc_read,
};

static void bsp_adc_configuration(void){
	g_dev_adc.name = "DEVICE_ADC";
	g_dev_adc.dops = &master_adc_Ops;
    cola_device_register(&g_dev_adc);
}
register_initcall(bsp_adc_configuration);




